﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using MvcApplication.CommonForm.Data;
using MvcApplication.Entity.User;
using MvcApplication.CommonForm.Interface;

namespace MvcApplication.Service.CommonForm.Service
{
    public class DemonService : IDemonService
    {
        public void Test()
        {
            using (var transaction = ConnectionUtil.CommonFormConnection.BeginTransaction())
            {
                ConnectionUtil.CommonFormConnection.Query<object>("Insert Into User(Id) Value(2)", null, transaction);
                ConnectionUtil.CommonFormConnection.Query<object>("Insert Into UserPassword(Id) Value(2)", null, transaction);
                transaction.Rollback();
            }
        }

        public List<User> TestDemon()
        {
            using (var ctx = new CommonFormContext())
            {
                //var users = ctx.User.Take(100).ToList();
                //return users;
                return null;
            }
        }
    }
}
